/**
 * userCenter相关客户端接口
 * @class userCenter
 * @extends core Api
 * @constructor
 * @module modules
 * @example
 *      import userCenterApi from 'clientApi/userCenterApi'
 *      userCenterApi.logIn(this.formData.phone, this.formData.password, function(data){
 *           console.log(data);
 *       })
 * @since 1.0.0
 * @public
 */

import core from 'gapi/core'
class userCenterApi extends core{
/**
 * 登录
 * @method logIn
 * @public
 * @param {String} phone 手机号
 * * @param {String} verifyCode 手机验证码
 * @param {String} password 登陆密码
 * @param {JSON} json 扩展json数据
 * @param {Functioni} 回调函数
 * @return {Object}
 * {data:信息}
 * @example
 *        userCenter.logIn(13001135920, '', 123456, {} ,function(data){
 *          console.log(data);
 *      });
 * @since 1.0.0
 */
   logIn (phone, verifyCode, password, json, callBack) {
       this.sendData({
            method: "logIn",
            param: {
                "mobile": phone,
                "code": verifyCode,
                "psw": password,
                "json": json
            },
            callBack: callBack
        });
   }
/**
 * 注册
 * @method register
 * @public
 * @param  {String} phoneNumber 用户手机号
 * @param  {String} verifyCode 验证码
 * @param  {String} psw 密码
 * @param {JSON} json 扩展json数据
 * @param {Functioni} 回调函数
 * @return {Object}
 * @example
 *        import userCenterApi from 'clientApi/userCenterApi'
 *        userCenter.register(13001135920, 3333, 123456, {} ,function(data){
 *          console.log(data);
 *      });
 */
        register  (phoneNumber,verifyCode,psw,json,callBack) {
        this.sendData({
            method: "register",
            param: {
                'mobile':phoneNumber,
                'code':verifyCode,
                'password':psw,
                'json':json
            },
            callBack: callBack
        });
    }
    /**
     * 获取当前客户端的服务接口域名信息(只用于Saas登录模块, C端)
     * @method getHost
     * @public
     * @param {Function} callBack 回调函数
     * @return {Object}
     * {info: "http://api.k.sohu.com/"}
     * @example
     *        userCenter.getHost(function(host){
     *          console.log(host.info);
     * 	    }
     * @since 1.0.0
     */
        getHost (callBack) {
            this.sendData({
                method: "getHost",
                param: {
                    "info": "getHost"
                },
                callBack: callBack
            });
        }
        /**
     * 给客户端传递用户realname,用于判断用户资料是否完善
     * @method userInfoCompleted
     * @public
     * @param {Function} callBack 回调函数
     * @return {Object}
     * @example
     *        userCenter.userInfoCompleted(name, data => {
     *
     * 	    }
     * @since 1.0.0
     */
        userInfoCompleted (name,callBack) {
            this.sendData({
                method: "userInfoCompleted",
                param: {
                    "name": name
                },
                callBack: callBack
            });
        }
        /**
         * 获取用户信息
         * @method getUserInfo
         * @public
         * @param {Function} callBack 回调函数
         * @return {Object}
         * {data:信息}
         * @example
         *      UCApi.getUserInfo(function(data){
         *          console.log(data);
         *      });
         * @since 2.3.0
         */
        getUserInfo (callBack){
            this.sendData({
                method: "getUser",
                param: {
                    "info": "getUser"
                },
                callBack: callBack
            });
        }
        /**
         * 打电话
         * @method makePhoneCall
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.makePhoneCall(phoneNumber);
         * @since 1.0.0
         */
        makePhoneCall (phoneNumber) {
            this.sendData({
                method: "makePhoneCall",
                param: {
                    "phoneNumber":phoneNumber
                }
            });
        }
        /**
         * 退出登录
         * @method logOut
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */

        logOut (){
            this.sendData({
                method: "logOut",
                param: {
                }
            });
        }
        /**
         * 获取端口号
         * @method logOut
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */
         getAppVersion (callBack){
            this.sendData({
                method: "getAppVersion",
                param: {
                    
                },
                callBack: callBack
            });
        }
        /**
         * 获取图片验证码
         * @method logOut
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */
         showCodeDialog (phone,callBack){
            this.sendData({
                method: "showCodeDialog",
                param: {
                    "mobile": phone,
                    "data": "showCodeDialog"
                },
                callBack: callBack
            });
        }
        /**
         * 获取设备型号
         * @method logOut
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */
         getDeviceInfo (callBack){
            this.sendData({
                method: "getDeviceInfo",
                param: {
                    "info": "getDeviceInfo"
                },
                callBack: callBack
            });
        }
        /**
         * 第三方登录
         * @method thirdPartyLogin
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.thirdPartyLogin;
         * @since 1.0.0
         */
         thirdPartyLogin (callBack){
            this.sendData({
                method: "thirdPartyLogin",
                param: {
                    "info": "thirdPartyLogin"
                },
                callBack: callBack
            });
        }
         /**
         * 获取微信信息
         * @method thirdPartyLogin
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.thirdPartyLogin;
         * @since 1.0.0
         */
         getWxInfo (callBack){
            this.sendData({
                method: "getWxInfo",
                param: {
                    "info": "getWxInfo"
                },
                callBack: callBack
            });
        }
         /**
         * 绑定手机号登录
         * @method bindPhoneNumSuccess
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.bindPhoneNumSuccess;
         * @since 1.0.0
         */
        bindPhoneNumSuccess (doumi_user_id, baxian_user_id, mobile, real_name, callBack) {
           this.sendData({
                method: "bindPhoneNumSuccess",
                param: {
                    "doumi_user_id": doumi_user_id,
                    "baxian_user_id": baxian_user_id,
                    "mobile": mobile,
                    "real_name": real_name
                },
                callBack: callBack
            });
        }
         /**
         * 绑定手机号登录
         * @method bindPhoneNum
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.bindPhoneNum;
         * @since 1.0.0
         */
        bindPhoneNum (mobile, code, callBack) {
           this.sendData({
                method: "bindPhoneNum",
                param: {
                    "mobile": mobile,
                    "code": code
                },
                callBack: callBack
            });
        }
        /**
         * 获取是否安装微信
         * @method weixinIsInstall
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */
         weixinIsInstall (callBack){
            this.sendData({
                method: "weixinIsInstall",
                param: {
                    "info": "weixinIsInstall"
                },
                callBack: callBack
            });
        }
        /**
         * 更新我的页面
         * @method logOut
         * @public
         * @param {String} phoneNumber 客服电话
         * @return {Null} void
         * @example
         *      userCenterApi.logOut;
         * @since 1.0.0
         */

        updateUserInfo (){
            this.sendData({
                method: "updateUserInfo",
                param: {
                }
            });
        }
        

}

export default new userCenterApi({
	name: 'usercenter api',
	author: 'lvpeng@doumi.com',
	version: '1.0',
	jsbc: jsBridgeClient,
	// nativeCls 一定要和客户端的同学对应
	nativeCls: 'userCenterApi'
})
